import Vue from 'vue'
import { auth } from '../library/auth'

Vue.directive('submit', {
  inserted (el, binding) {
    el.onsubmit = function (evt) {
      evt.preventDefault()
      if (binding.value) {
        binding.value.call(null, evt, binding.arg, binding.modifiers)
      }
    }
  }
})


Vue.directive('auth', {
  inserted (el, binding) {
    if (!auth.chkAuth(binding.value)) {
      el.style.display = 'none'
    }
  }
})
